Interface:
  It is a blue print OR template which provides a base to the child class. 


Q: When to go for interface?
Ans:
When all the child classes has to implement different behaviours from the different parent classes.
Bcoz interface supports Multiple inheritance. So child class can implements more than one parent class.


Rules for interfaces:
1. Interface can contains only abstract methods (upto java 7), But from java 8 onwards interface can have abstract methods, static methods with body, default methods with body and private method with body.

2. We cannot create a constructor, instance method, instance block and static block inside the interface.

3. We cannot create a object to interface. But we can give interface variable as a reference to child class object. If we follow the above approach then we can access only interface members but cannot access Child class members except Overriding.

4. Any child class which implements interface must provide body/implementations to all the abstract methods available in the interface. If not, the child class will become abstract class

5. When child class implements the abstract methods of the interface then the visibility must be public bcoz all the interface members will have public scope.

6. In interface the abstract keyword is not mandatory for defining the abstract methods.

7. Child class object cannot access static methods available in the interface. The static methods has to be accessed through interface name reference.

8. If we create a object to child class then we can access interface members and as well as child class members.

9. When interface extends another interface we cannot provide the implementation to abstract methods available in the parent interface.

10. In interface all the variables are implicitly will have public, final & static scope.

11. To establish Parent & child class relationship @ interface level we use implements keyword. This keyword supports multiple parent classes

Ex: class Child implements Parent
==============================

Diamond problem in interface.

Duplicate default methods named method1 with the parameters () and () are inherited from the types B and A

===================================================
Possible inheritance:
(1) class A extends class B (Simple Inheritance)
(2) Class A and Class B extends Class C (Hierarchial Inheritance)
(3) class A extends abstract class B (Simple Inheritance)
(4) abstract class A extends class B (Simple Inheritance)
(5) class A implements interface B,C (Multiple Inheritance)
(6) class A extends class B implements interface C (Multiple Inheritance)
(7) class A extends abstrct class B implements interface C (Multiple Inheritance)
(8) interface A extends interface B (Simple Inheritance)


Not possible inheritance:
class A implements interface B extends class C
interface A implements interface B
class A extends class B & class C
